package com.gupao.singletondemo.lazy;


//静态内部类模式，既能保证线程安全，又不影响性能
//外部类被调用的时候内部类
public class LazyThree {

    private LazyThree() {
    }

    private static volatile LazyThree lazyThree = null;

    public static LazyThree getInstance() {
        //返回结果之前一定被加载
        return LazyHolder.LAZY_THREE;
    }


    //默认不加载
    private static class LazyHolder {
        private static final LazyThree LAZY_THREE = new LazyThree();
    }
}
